/*
 * @Author: ckk
 * @Date: 2022-10-24 22:01:24
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-07-13 15:37:57
 * @Description: app认证
 */
import axios from './request';
const baseUrl = '';
// https://nhhht.hhhtjy.org.cn'
/**
 * @description: 公众号认证
 * @param {*} params
 * @Author: ckk
 * @Date: 2022-08-18 14:13:48
 * @return {*}
 */
// qcapp/login/token
export async function getAuthToken (params) {
    // const Qs = require('qs'),
       const { data } = await axios({
        method: 'POST',
        url: baseUrl + '/qcapp/login/token',
        params: params
    }
    );
    return (data || {});
}
/**
 * @description: 获取用户信息
 * @param {*} param
 * @Author: ckk
 * @Date: 2022-10-24 22:56:12
 * @return {*}
 */
// qcapp/login/userinfo
export async function getAuthUser (params) {
    const { data } = await axios.get(`${baseUrl}/qcapp/login/userinfo`, { params });
    return data;
}
/**
 * @description: app认证
 * @param {*} params
 * @Author: ckk
 * @Date: 2022-08-18 14:13:48
 * @return {*} /sso/oauth/service/token?grant_type=trust_code_temp
 */
export async function appUseAttestation (params) {
  localStorage.removeItem('auth_token');
const Qs = require('qs'),
    { data } = await axios({
    method: 'POST',
    url: baseUrl + '/sso/oauth/service/token?grant_type=trust_code_temp',
    headers: {
    Authorization: 'Basic ' + 'dXhpbjowNjNiMzdiYjIzNTY1MzdiMjMxNTQ1NGYxYjc4ODhkOQ==',
    'content-type': 'application/x-www-form-urlencoded'
    },
    data: Qs.stringify(params)

}
);
return (data || {});
}
/**
 * @author: ckk
 * @description: 鉴权接口
 * @param {*} params
 * @return {*}
 */
export async function getAuthentication () {
  const { data } = await axios.get(
    `${process.env.VUE_APP_UC_URL}/pd-grant/v3/pdGrant`
  );
  return data || {};
}
